<template>
	<view class="body">
		<view class="header">
			<text class="iconfont icon-dingwei"></text>
			<text>南航碧桂园小区</text>
		</view>
		<text class="word">请选择要开的门并保持蓝牙距离在100米以内</text>
		<view class="door">
			<view id="doors" data-sel="南门" @click="sel1" :class="select=='南门'?'active':''">
				<text class="iconfont icon-shoujikaimen"></text>
				<view id="doors1">
					<view>南门</view>
					<view>小区1号大门</view>
				</view>
			</view>
			<view id="doors" data-sel="东门" :class="select=='东门'?'active':''" @click="sel1">
				<text class="iconfont icon-shoujikaimen"></text>
				<view id="doors1">
					<view>东门</view>
					<view>小区2号大门</view>
				</view>
			</view>
			<view id="doors" data-sel="西门" :class="select=='西门'?'active':''" @click="sel1">
				<text class="iconfont icon-shoujikaimen"></text>
				<view id="doors1">
					<view>西门</view>
					<view>小区3号大门</view>
				</view>
			</view>
			<view id="doors" data-sel="1单元门" :class="select=='1单元门'?'active':''" @click="sel1">
				<text class="iconfont icon-shoujikaimen"></text>
				<view id="doors1">
					<view>1单元门</view>
					<view>4号楼1单元门</view>
				</view>
			</view>
		</view>

		<button class="btn" @click="dialogToggle('success')">确认开门</button>
		<view>
			<!-- 提示窗示例 -->
			<uni-popup ref="alertDialog" type="dialog">
				<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="确认" content="开门成功!"
					@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
			</uni-popup>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				select: '南门',
				msgType: 'success',
				messageText: '这是一条成功提示',
				value: ''
			};
		},
		methods: {
			sel1(ev) {
				this.select = ev.currentTarget.dataset.sel;
				// console.log(this.select)
			},
			change(e) {
				console.log('当前模式：' + e.type + ',状态：' + e.show);
			},
			toggle(type) {
				this.type = type
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type)
			},
			messageToggle(type) {
				this.msgType = type
				this.messageText = `这是一条${type}消息提示`
				this.$refs.message.open()
			},
			dialogToggle(type) {
				this.msgType = type
				this.$refs.alertDialog.open()
			},
			dialogConfirm() {
				console.log('点击确认')
				this.messageText = `点击确认了 ${this.msgType} 窗口`
				this.$refs.message.open()
			},
			inputDialogToggle() {
				this.$refs.inputDialog.open()
			},
			dialogClose() {
				console.log('点击关闭')
			},
			dialogInputConfirm(val) {
				uni.showLoading({
					title: '3秒后会关闭'
				})

				setTimeout(() => {
					uni.hideLoading()
					console.log(val)
					this.value = val
					// 关闭窗口后，恢复默认内容
					this.$refs.inputDialog.close()
				}, 3000)
			},
			shareToggle() {
				this.$refs.share.open()
			}
		}
	}
</script>

<style lang="less">
	@import url("../../static/font/iconfont.css");

	.body {
		.header {
			width: 750rpx;
			height: 132rpx;
			// background-color: hotpink;
			line-height: 132rpx;
			font-size: 40rpx;
		}

		.header :nth-child(1) {
			margin: 50rpx 18rpx 40rpx 32rpx;
			font-size: 40rpx;
		}

		.word {
			margin-left: 32rpx;
			color: #767676;
		}

		.door {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-around;
			margin-top: 50rpx;

			#doors {
				width: 318rpx;
				height: 174rpx;
				display: flex;
				align-items: center;
				// background-color: #ffffff;
				border-radius: 16rpx;
				margin-bottom: 40rpx;
				border: 1rpx solid #eee;


				.iconfont {
					font-size: 64rpx;
					margin: 0 20rpx;
				}

				#doors1 :nth-child(1) {
					font-size: 45rpx;
					margin-bottom: 24rpx;
				}
			}

		}

		.door .active {
			background-color: #5500ff;
			color: #fff;
		}

		.btn {
			width: 670rpx;
			height: 90rpx;
			background-color: #2ed477;
			color: #fff;
			margin-top: 52rpx;
		}
	}
</style>
